package main

import (
	"fmt"
	"sort"
)

func main() {
	var a []TT
	a = append(a, TT{
		name: "ipfs-node-1",
		age:  11,
	}, TT{
		name: "ipfs-node-2",
		age:  12,
	}, TT{
		name: "ipfs-cluster-1",
		age:  13,
	})
	sort.Sort(B(a))
	fmt.Println(a)
}

type TT struct {
	name string
	age  int
}

type B []TT

func (receiver B) Len() int           { return len(receiver) }
func (receiver B) Swap(i, j int)      { receiver[i], receiver[j] = receiver[j], receiver[i] }
func (receiver B) Less(i, j int) bool { return receiver[i].name < receiver[j].name }
